"""
URL builder for FPS calculator
"""
from typing import List, Tuple
from models.database import CPU, GPU, Game

class URLBuilder:
    BASE_URL = "https://pc-builds.com/fps-calculator/result"
    
    @staticmethod
    def build_url(cpu: CPU, gpu: GPU, game: Game) -> str:
        """Build FPS calculator URL for given CPU, GPU and Game"""
        return f"{URLBuilder.BASE_URL}/{cpu.cpu_str_id}{gpu.gpu_str_id}/{game.game_str_id}/{game.slugs}"
    
    @staticmethod
    def get_combinations(session) -> List[Tuple[CPU, GPU, Game]]:
        """Get all valid combinations of CPU, GPU and Game"""
        # Get enabled CPUs
        cpus = session.query(CPU).filter(CPU.status == 1).all()
        
        # Get enabled GPUs
        gpus = session.query(GPU).filter(GPU.status == 1).all()
        
        # Get hot games
        games = session.query(Game).filter(Game.status == 4).all()
        
        # Generate all combinations
        combinations = []
        for cpu in cpus:
            for gpu in gpus:
                for game in games:
                    combinations.append((cpu, gpu, game))
        
        return combinations 